﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace canyinguanlixitong
{
    public partial class frm库存查询 : Form
    {
        public frm库存查询()
        {
            InitializeComponent();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
           string str = "Data Source=.;Initial Catalog=Supermarket management system;Integrated Security=True";
     
        public void chaxun()
        {
            SqlConnection conn = new SqlConnection(str);
            DataSet ds = new DataSet("Student");
            string sql = @"select spID,spName,slLei,spJia,danwei,sum from dbo.commodity,[Commodity type],dbo.sangping
where commodity.spLei=[Commodity type].SlId and dbo.sangping.commid=dbo.commodity.spID and spID like'%"+this.txtname.Text+"%'";
            SqlDataAdapter asdf = new SqlDataAdapter(sql, conn);
            asdf.Fill(ds, "Student");
            this.dataGridView1.DataSource = ds.Tables["Student"];

        }

        private void frm库存查询_Load(object sender, EventArgs e)
        {
            chaxun();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            chaxun();
        }
       
    }
}
